#include "widget.h"
#include "ui_widget.h"
#include <QIcon>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QIcon icon(":/fufu.jpeg");
    setWindowIcon(icon);
    //设置光标
    QPixmap pixmap(":/fufu.jpeg");
    pixmap=pixmap.scaled(50,50);
    QCursor cursor(pixmap);
    this->setCursor(cursor);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_accept_clicked()
{
    ui->label->setText("已同意请求!");
    ui->pushButton_reject->setEnabled(false);
}


void Widget::on_pushButton_reject_clicked()
{
//    srand(time(0));//设置随机种子
//    int width=this->geometry().width();
//    int height=this->geometry().height();
//    int x=rand()%width;
//    int y=rand()%height;
//    ui->pushButton_reject->move(x,y);
}

void Widget::on_pushButton_reject_pressed()
{
    srand(time(0));//设置随机种子
    int width=this->geometry().width();
    int height=this->geometry().height();
    int x=rand()%width;
    int y=rand()%height;
    ui->pushButton_reject->move(x,y);
}
